package org.jeecg.modules.cascv.image.util;

import cn.hutool.core.util.HexUtil;
import org.jeecg.common.constant.CommonConstant;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

public class LaptopUtil {

    public static Long getSecondTime(String value){
        if (!value.contains(":")) {
            return Long.valueOf(value);
        }
        String[] times=value.split(":");
        Long second=Long.valueOf(times[0])*86400+Long.valueOf(times[1])*3600+Long.valueOf(times[2])*60+Long.valueOf(times[3]);
        return second;
    }

    //把秒变成 天:时:分:秒
    public static String toDayHoursMinSec(Long time){
        long day = TimeUnit.SECONDS.toDays(time);
        long hours = TimeUnit.SECONDS.toHours(time) - TimeUnit.DAYS.toHours(TimeUnit.SECONDS.toDays(time));
        long minutes = TimeUnit.SECONDS.toMinutes(time) - TimeUnit.HOURS.toMinutes(TimeUnit.SECONDS.toHours(time));
        long seconds = TimeUnit.SECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(TimeUnit.SECONDS.toMinutes(time));
        // 172800+14400+1720
        return day+":"+hours+":"+minutes+":"+seconds;
    }
}
